<?php if (empty($model->name)):?>
<h2>Create Role</h2>
<?php else:?>
<h2>Update Role <?php echo $model->name;?></h2>
<?php endif;?>
<?php if (Yii::app()->user->hasFlash('success')):?>
    <p><?php echo Yii::app()->user->getFlash('success');?></p>
<?php endif;?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'auth_item-form',
)); ?>

    <?php echo $form->errorSummary($model); ?>
    <?php echo $form->hiddenField($model, 'type', array('value'=>FAuthManager::ROLE_ITEM_TYPE)); ?>
    <?php echo $form->hiddenField($model, 'nameOld'); ?>    
    <?php echo $form->hiddenField($model, 'isNew'); ?>

    <div class="row">
        <?php echo $form->labelEx($model,'name'); ?>
        <?php echo $form->textField($model,'name'); ?>
        <?php echo $form->error($model,'name'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'description'); ?>
        <?php echo $form->textarea($model,'description'); ?>
        <?php echo $form->error($model,'description'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'bizrule'); ?>
        <?php echo $form->textarea($model,'bizrule'); ?>
        <?php echo $form->error($model,'bizrule'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'data'); ?>
        <?php echo $form->textarea($model,'data'); ?>
        <?php echo $form->error($model,'data'); ?>
    </div>

    <?php if (! $model->isNew && count($parents)):?>
    <div class="row checkbox">
        <?php echo CHtml::label('Parents', '');?><br/>
        <?php echo CHtml::checkBoxList('parents', $selected, $parents); ?>
    </div>
    <?php endif;?>


    <div class="row buttons">
        <?php echo CHtml::submitButton('Save'); ?>
    </div>

<?php $this->endWidget(); ?>

</div><!-- form -->